package com.liangzhong.view.tips
{
	import com.common.utils.DisplayObjectUtil;
	
	import flash.display.Sprite;
	import flash.geom.Rectangle;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	import lz.controls.tips.ITip;

	/**
	 * 普通提示
	 * @author lake
	 * 
	 */	
	public class CommonTips extends Sprite implements ITip
	{
		private var _data :String ;
		
		public function CommonTips()
		{
			super();
		}
		
		public function get data():Object
		{
			return _data;
		}
		
		public function set data(value:Object):void
		{
			_data = value as String;
			//text field
			var tf :TextField = new TextField();
			tf.gridFitType = "pixel";
			tf.autoSize = TextFieldAutoSize.CENTER;
			tf.selectable = false;
			tf.multiline = true;
			tf.wordWrap = true;
			tf.htmlText = _data;
			tf.x = 3;
			addChild(tf);
			//draw bg
			var bounds:Rectangle = getBounds( tf );
			graphics.beginFill(0xffffff,1);
			graphics.drawRoundRect( 0, 0, tf.textWidth + 10, bounds.height, 10);
		}
		
		public function destroy():void
		{
			DisplayObjectUtil.removeAllChildren(this);
		}
	}
}